package helper.wsdlHelper;

import java.util.HashMap;



 
/**
 * This class provides static methods to invoke WebServices offered by a WSDL document.
 * @author Christian Stamber
 */
public class WSDLHelper {
	
	/*
	private HashMap invokeWebService2(String wsdlLocation, String portType, String operation, String[] input){
		System.out.println("porttype: "+portType+" operation: " + operation);
		
		try {
            DynamicBinder dBinder = getDynamicBinder(wsdlLocation);
            dBinder.wsdlHelper.wsdlParser.setTimeout(240000);
            HashMap res = dBinder.wsdlHelper.invokeMethod(operation,portType,input);
            return res;
        }
        catch (Exception e) {
            throw new ComponentException(e);
        }
	}*/
	

	public static HashMap invokeWebService(String wsdlLocation, String portType, String operation, String[] input) throws Exception{
		DynamicInvoker invoker= new DynamicInvoker(wsdlLocation);
		
		HashMap result;
		
		result=invoker.invokeMethod(operation, portType, input);
		
		return result;
	}
	
	/**
	 * This method invokes a web service by a already assembled body of a SOAP message. Result is the SOAP body of the resulting
	 * message.
	 * @param wsdlLocation
	 * @param portType
	 * @param operation
	 * @param soapBody
	 * @return
	 * @throws Exception
	 */
	public static String invokeWebService(String wsdlLocation, String portType, String operation, String soapBody) throws Exception{
		DynamicInvokerSOAP invoker= new DynamicInvokerSOAP();
		
		String resultSoapBody;
		
		resultSoapBody=invoker.invokeMethod(wsdlLocation, operation, portType, soapBody);
		
		return resultSoapBody;
	}
	
	
	
}
